"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const withInstall = require("../../utils/withInstall.cjs");
require("./delete-tips.vue.cjs");
require("./delete-api-tips.vue.cjs");
const deleteTips_vue_vue_type_script_setup_true_lang = require("./delete-tips.vue2.cjs");
const deleteApiTips_vue_vue_type_script_setup_true_lang = require("./delete-api-tips.vue2.cjs");
const DeleteTips = withInstall.default(deleteTips_vue_vue_type_script_setup_true_lang.default);
const visible = vue.ref(false);
let isDestroyed = false;
const destory = (container) => {
  setTimeout(() => {
    var _a;
    vue.render(null, container);
    container && ((_a = container.parentNode) == null ? void 0 : _a.removeChild(container));
    isDestroyed = true;
  }, 350);
};
DeleteTips.createInstance = (options) => {
  const container = document.createElement("div");
  visible.value = true;
  isDestroyed = false;
  document.body.appendChild(container);
  const DeleteTipsWrapper = vue.defineComponent({
    name: "DeleteTipsWrapper",
    setup() {
      vue.onBeforeUnmount(() => {
        visible.value = false;
        if (!isDestroyed) {
          destory(container);
        }
      });
      return () => {
        return vue.h(deleteApiTips_vue_vue_type_script_setup_true_lang.default, {
          ...options,
          show: visible.value,
          onOk() {
            options.onOk && options.onOk();
            destory(container);
            visible.value = false;
          },
          onCancel() {
            options.onCancel && options.onCancel();
            visible.value = false;
            destory(container);
          }
        });
      };
    }
  });
  const vm = vue.createVNode(DeleteTipsWrapper);
  vue.render(vm, container);
};
const deleteTips = {
  tips(options) {
    DeleteTips.createInstance(options);
  }
};
exports.DeleteTips = DeleteTips;
exports.deleteTips = deleteTips;
//# sourceMappingURL=index.cjs.map
